#!/bin/bash

echo "启动Docker MySQL容器..."

# 检查Docker是否运行
if ! docker info > /dev/null 2>&1; then
    echo "错误：Docker未运行，请先启动Docker"
    exit 1
fi

# 启动MySQL容器
echo "正在启动MySQL和phpMyAdmin容器..."
docker-compose up -d

# 等待MySQL启动
echo "等待MySQL启动..."
sleep 15

# 检查容器状态
echo "检查容器状态："
docker-compose ps

echo ""
echo "MySQL容器已启动！"
echo "数据库信息："
echo "  主机: localhost"
echo "  端口: 3306"
echo "  数据库: quantitative_advanced"
echo "  用户名: quantitative_user"
echo "  密码: quantitative_password"
echo ""
echo "phpMyAdmin管理界面："
echo "  URL: http://localhost:8080"
echo "  用户名: root"
echo "  密码: quantitative_password"
echo ""
echo "现在可以运行数据库测试："
echo "  python database/test_database.py"
echo ""
